<?php $this->load->view('headerfooter/header'); ?>

<!-- Begin page content -->
<div class="container">
    <div class="col-sm-4 col-sm-offset-1">
        <div class="panel panel-success">
            <div class="panel-heading">
                <div class="panel-title">
                <?php
				$princat = array();
				for($i = count($breadcrumb)-1; $i>=0 ; $i--){ $printcat = $breadcrumb[$i]; ?>
					<a href="<?=site_url()?>/surat/category/<?=$printcat['id']?>"><?=$printcat['nama_kategori']?></a>
					<?php if($i != 0){?> » <?php } ?>
				<?php } ?>
                </div>
            </div>
			<div class="panel-isi" id="printableArea">
            <?php if (!isset($message)) : ?>
                <table class="table table-striped">
                    <thead>
						<tr>
							<th>No</th>
							<th>Kode Surat</th>
							<th>Nama Instansi</th>
							<th>Tanggal Kerjasama</th>
							<th>Masa Berlaku</th>
							<th>Kerjasama</th>
							<th>Nomer Surat</th>
							<th>Unit Terkait</th>
							<th class="noPrint">Action</th>
						</tr>
                    </thead>
                    <tbody class="table-hover">
                    <?php
                    $i = 0;
                    foreach ($query->result() as $row) :
                        ?>
                        <tr>
                            <td><?= ++$i ?></td>
                            <td><?= $row->kode_surat ?></td>
							<td><?= $row->nama_instansi ?></td>
							<td><?= $row->tanggal_kerjasama ?></td>
							<td><?= $row->masa_berlaku ?></td>
							<td><?= $row->kerjasama_mengenai ?></td>
							<td><?= $row->nomersurat ?></td>
							<td><?= $row->unit_terkait ?></td>
                            <td class="noPrint"><a href="<?=site_url()?>/surat/view/<?=$row->idsurat?>" class="btn btn-primary">
								<i class="fa fa-eye"></i> View
							</a>&nbsp;
                            <!-- a href="<?=site_url()?>/surat/edit/<?=$row->idsurat?>" class="btn btn-primary">
								<i class="fa fa-pencil"></i> Edit
							</a --></td>
                        </tr>
                    <?php endforeach; ?>
					</tbody>
					
                </table>
				<div style="margin-left:25%">
					<div class="text-right">
						<?php echo $pagination;?>
					</div>
					<a type="button" class="noPrint btn btn-lg btn-warning" href="<?=site_url()?>/surat"><i class="fa fa-upload"></i> Upload Surat Baru</a>
					<button class="btn btn-danger btn-lg noPrint" type="button" onclick="printDiv('printableArea')"  /><i class="fa fa-print"></i> Cetak Hasil Pencarian</button>
			</div>
			<script type="text/javascript">
				function printDiv(divName) {
					var printContents = document.getElementById(divName).innerHTML;
					var originalContents = document.body.innerHTML;
					document.body.innerHTML = printContents;
					window.print();
					document.body.innerHTML = originalContents;
				}
			</script>
            <?php else : ?>
			<h3 class="text-center"><?= $message ?></h3>
			<div class="container">
				<div style="max-width:72.5%;padding:20px">
                    <a type="button" class="btn btn-lg btn-warning btn-block" href="<?=site_url()?>/surat"><i class="fa fa-upload"></i> Upload Surat Baru</a>
				</div>
			</div>
            <?php endif; ?>
			
			
			</div>
        </div>
    </div>
</div>

<?php $this->load->view('headerfooter/footer'); ?>
